package com.ks.fission.controller;


import com.ks.core.base._ControllerBase;
import com.ks.core.core.Result;
import com.ks.core.dto.OperateBase;
import com.ks.core.dto.SearchCriteriaBase;
import com.ks.fission.entity.BFissionReward;
import com.ks.fission.service.IBFissionRewardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 裂变-分享奖励规则 前端控制器
 * </p>
 *
 * @author kingdee123
 * @since 2020-12-21
 */
@RestController
@RequestMapping("/bFissionReward")
@Api(value = "分享裂变奖励规则模块", description = "分享裂变奖励规则模块")
public class BFissionRewardController extends _ControllerBase {

    @Resource
    private IBFissionRewardService ibFissionRewardService;

    @PostMapping("/insertBFissionReward")
    @ApiOperation(value = "分享任务奖励规则添加", notes = "BFissionReward 规则数据")
    public Object insertBFissionReward(@RequestBody BFissionReward bFissionReward) {
        int i=ibFissionRewardService.insertBFissionTask(getContext(),bFissionReward);
        return Result.success(i);
    }

    @PostMapping("/deleteBFissionReward")
    @ApiOperation(value = "分享任务奖励规则删除", notes = "BFissionReward id")
    public Object deleteBFissionReward(@RequestBody OperateBase operateBase) {
        int i=ibFissionRewardService.deleteBFissionReward(getContext(),operateBase);
        return Result.success(i);
    }

    @PostMapping("/updateBFissionReward")
    @ApiOperation(value = "分享任务奖励规则修改", notes = "BFissionReward 规则数据")
    public Object updateBFissionReward(@RequestBody BFissionReward bFissionReward) {
        int i=ibFissionRewardService.updateBFissionReward(getContext(),bFissionReward);
        return Result.success(i);
    }

    @PostMapping("/selectBFissionReward")
    @ApiOperation(value = "分享任务奖励规则查找", notes = "查询条件：tenantID 租户代码 createUserID 创建人 createTime 创建时间 ；分页条件")
    public Object selectBFissionReward(@RequestBody SearchCriteriaBase searchCriteriaBase) {
        Map<String,Object> resultMap=ibFissionRewardService.selectBFissionReward(getContext(),searchCriteriaBase);
        return Result.success(resultMap);
    }
}

